package gae.testjig.server;

import gae.testjig.client.ClientChannelId;

import com.google.appengine.api.channel.ChannelMessage;
import com.google.appengine.api.channel.ChannelService;
import com.google.appengine.api.channel.ChannelServiceFactory;

public class ChannelLogger {
	
	private ChannelService channelService;
	private ClientChannelId clientChannelId;

	public ChannelLogger(ClientChannelId clientChannelId) {
		this.channelService = ChannelServiceFactory.getChannelService();
		this.clientChannelId = clientChannelId;
	}
	
	public void info(String message) {
		channelService.sendMessage(new ChannelMessage(clientChannelId.getClientId(), "{\"channelId\": \""+clientChannelId.getChannelId()+"\", \"info\": \""+message+"\"}"));
	}

}
